package com.privat.einkaufsscan;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class SQLHelper extends SQLiteOpenHelper {
	public static final String TABLE_NAME = "Produkte";
	public static final String COLUMN_ID = "id";
	public static final String COLUMN_CODE = "code";
	public static final String COLUMN_PRODUKT = "produkt";
	public static final String COLUMN_ORT = "ort";
	public static final String COLUMN_COUNT = "count";
	
	private static final String DATABASE_NAME = "EinkaufsScan";
	private static final int DATABASE_VERSION = 1;
	
	private static final String DATABASE_CREATE = "create table "
		+ TABLE_NAME + "(" + COLUMN_ID + " integer primary key autoincrement," 
		+ COLUMN_CODE + " text, " + COLUMN_PRODUKT + " text not null, "
		+ COLUMN_ORT + " text not null, " + COLUMN_COUNT + " integer not null);";
	
	public SQLHelper(Context context)
	{
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
	}
	
	@Override
	public void onCreate(SQLiteDatabase database) {
		database.execSQL(DATABASE_CREATE);
	}
	
	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		//nothing todo
	}
}
